package com.yundingai.common;

import com.yundingai.domain.vo.RoomChatVo;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import static com.yundingai.config.RabbitConfig.ROOM_EXCHANGE_NAME;

/**
 * @Author zhaoj
 * @Date 2025/7/19 14:21
 * @Description TODO
 **/
@Component
public class RabbitSender {
    @Autowired
    private RabbitTemplate rabbitTemplate;

    public void sendChat(RoomChatVo roomChatVo) {
        rabbitTemplate.convertAndSend(ROOM_EXCHANGE_NAME, "chat." + roomChatVo.getRoomId(), roomChatVo);
    }
}
